<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
		<link rel="stylesheet" type="text/css" href="../../css/jquery-weui.min.css" />
		<link rel="stylesheet" type="text/css" href="../../css/index.css" />
		<link rel="stylesheet" type="text/css" href="../../css/mine.css" />
		<link rel="stylesheet" type="text/css" href="https://at.alicdn.com/t/font_546019_o8qxm6fupb0ggb9.css" />
		<title>过磅单信息</title>
		<script src="../../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/baseConfig.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<style type="text/css">
		.nameWarp,.childName{
			width: 100%;
			height: auto;
			overflow: hidden;
		}
		.nameWarp .firstName{
			width: 100%;
			height: 1.55rem;
			background: #eee;
			line-height: 1.55rem;
		}
		.childName li{
			width: 100%;
			height: 1.55rem;
			font-size:0.75rem ;
			line-height: 1.55rem;
			border-bottom: 1px solid #eee;
		}
		.firstName span:nth-of-type(1){
			display: inline-block;
			float: left;
			width: 50%;
			padding-left:1.1rem;
			box-sizing: border-box;
		}
		.firstName span:nth-of-type(2),.childName li span:nth-of-type(2){
			display: inline-block;
			float: left;
			width: 25%;
		}
		.firstName span:nth-of-type(3),.childName li span:nth-of-type(3){
			display: inline-block;
			float: left;
			width: 25%;
			text-align: center;
			box-sizing: border-box;
		}
		.childName li span:nth-of-type(1){
			display: inline-block;
			float: left;
			width: 50%;
			padding-left:1.1rem;
			box-sizing: border-box;
		}
		.pinderation .identity-type span{
			color:#666 ;
		}
		.pinderation .identity-type .zjInfo{
			color: #28c81e;
			display: inline-block;
			float: right;
			padding-right: 1.15rem;
		}
	</style>
	<body>
		<!--<div id="header">
			<div class="header-title" style="position: fixed;top: 0;border-bottom: 0;">
				<img src="../../img/left.png" class="left" />
				<span>过磅单信息</span>
			</div>
		</div>-->
		<div class="pinderation" style="margin-top: 0;">
			<div class="identity-type">
				<span>基本信息</span>
				<span class="zjInfo">质检信息</span>
			</div>
			<div class="essen_list">
				<p>
					<span>车牌号</span>
					<b class="carNo"></b>
				</p>
				<p>
					<span>司机姓名</span>
					<b class="driver"></b>
				</p>
				<p>
					<span>司机电话</span>
					<b class="phone"></b>
				</p>
				<p>
					<span>收货时间</span>
					<b class="time"></b>
				</p>
				<p>
					<span>数量合计</span>
					<b class="numberTotal"></b>
				</p>
				<p>
					<span>重量合计</span>
					<b class="weightTotal"></b>
				</p>
			</div>
			<div id="nameWarp">
				<!--<div class="nameWarp">
					<div class="firstName">
						<span>电冰箱</span>
						<span>51台</span>
						<span>460KG</span>
					</div>
					<ul class="childName">
						<li>
							<span>CRT彩色电视机-21寸</span>
							<span>23台</span>
							<span>230KG</span>
						</li>
						<li>
							<span>CRT彩色电视机-21寸</span>
							<span>23台</span>
							<span>230KG</span>
						</li>
						<li>
							<span>CRT彩色电视机-21寸</span>
							<span>23台</span>
							<span>230KG</span>
						</li>
					</ul>
				</div>-->
			</div>
			
			<div class="seePonderation">
				<div class="demos-content-padded">
					<a href="javascript:;" class="weui-btn weui-btn_primary">确认过磅信息</a>
				</div>

			</div>

		</div>

	</body>
	<script type="text/javascript">
		$(document).ready(function() {
			baseConfig.historyBack()
			$.showLoading("加载中...");
			$.ajax({
				type: "get",
				url: baseConfig.localHttp + "weChatApi/fgclient/getMteGuobangInfo",
				async: false,
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
				data: {
					carId: baseConfig.GetQueryString("carId"),
				},
				success: function(data) {
					console.log(data)
					$.hideLoading();
					if(data.code == 100) {
						var list = data.content.list;
						var $div = ""
						
						$(".carNo").html(data.content.carNo);
						$(".driver").html(data.content.driver);
						$(".phone").html(data.content.phone)
						$(".time").html(data.content.receiveTimeStr)
						$(".numberTotal").html(data.content.count)
						$(".weightTotal").html(data.content.weight)
						for(var i=0;i<list.length;i++){		
							var $child = ""
							for(var j=0;j<list[i].materialList.length;j++){
								$child += "<li><span>"+list[i].materialList[j].secondParentName+"-"+list[i].materialList[j].materialName+"</span><span>"+list[i].materialList[j].counts+"台</span><span>"+list[i].materialList[j].weightCount+"KG</span></li>"
							}
							$div += "<div class='nameWarp'><div class='firstName'><span>"+list[i].firstParentName+"</span><span>"+list[i].counts+"台</span><span>"+list[i].weightCount+"KG</span></div><ul class='childName'>"+$child+"</ul></div>"
						}
						$("#nameWarp").append($div)
					//确认过磅单重量
					if(baseConfig.GetQueryString("enterStatus")==1){
						$(".weui-btn").hide()
					}else{
						$(".weui-btn").on("click", function() {
							location.href = "autograph.html?orderNo="+data.content.contractId+"&carNo="+data.content.carId
//							$.ajax({
//								type: "get",
//								url: baseConfig.localHttp + "weChatApi/fgclient/confirmPound",
//								async: false,
//								headers: {
//									'Content-Type': 'application/x-www-form-urlencoded'
//								},
//								data: {
//									orderNo: data.content.contractId,
//									carNo:data.content.carId
//								},
//								success: function(data) {
//									console.log(data)
//									if(data.code == 100) {
//										$.toptip(data.content, 1200, 'success');
//										location.href = "mine.html"
//									} else {
//										$.toptip(data.content, 1200, 'error');
//									}
//								},
//								error: function() {
//									$.hideLoading();
//									$.toast("请求失败", "cancel");
//								}
//							})
						})	
					}	
						
					} else {
						$.toptip(data.content, 1200, 'error');
					}
				},
				error: function() {
					$.hideLoading();
					$.toast("请求失败", "cancel");
				}
			})
			//质检信息
			$(".zjInfo").on("click",function(){
				location.href = "qualityInformation.html?carId="+baseConfig.GetQueryString("carId")
			})
		})
	</script>

</html>